load("//eden/scm:targets.bzl", "rust_python_library")

oncall("sapling")

rust_python_library(
    name = "cliparser",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {"cargo_toml_config": {
        "features": {
            "default": [],
            "python": ["cpython"],
        },
        "lib": {"name": "cliparser"},
        "package": {
            "authors": ["Facebook Source Control Team <sourcecontrol-dev@fb.com>"],
            "name": "sapling-cliparser",
        },
    }},
    features = [
        "python",
    ],
    # A test inside this target is using #[should_panic], setting the backtrace
    # to false here, otherwise the test binary will try to extract the backtrace
    # and the test will fail with leak sanitizer.
    test_env = {"RUST_BACKTRACE": "0"},
    test_labels = ["tpx-rust-no-backtrace-workaround"],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:indexmap",
        "fbsource//third-party/rust:serde",
        "fbsource//third-party/rust:shlex",
        "fbsource//third-party/rust:thiserror",
    ],
)
